Trigonometric funtions from "4,000 LINE SEGMENTS"

Charlie Veniot20th June 2022 at 10:10pm
' The trigonometric functions by Hamid Naderi Yeganeh from his original artwork (4,000 LINE SEGMENTS)
' https://blogs.scientificamerican.com/guest-blog/making-mathematical-art/

pi = 3.1415929
screen _newimage(4400, 4400, 21)
for k = 1 to 4000
a = sin(14 * pi * k / 4000) * ( (sin(16 * pi * k / 4000))^2 + (sin(14 * pi * k / 4000))^2 ) * 1000
b = cos(14 * pi * k / 4000) * ( (sin(16 * pi * k / 4000))^2 + (sin(14 * pi * k / 4000))^2 ) * 1000
c = sin(30 * pi * k / 4000) * ( (sin(16 * pi * k / 4000))^2 + (sin(14 * pi * k / 4000))^2 ) * 1000
d = cos(30 * pi * k / 4000) * ( (sin(16 * pi * k / 4000))^2 + (sin(14 * pi * k / 4000))^2 ) * 1000
couleur = &hff0000
if a+2200<=299 or a+2200>=4099 or b+2200<=299 or b+2200>=4099 then couleur = &hffff00
if a+2200>999 and a+2200<3399 then couleur = &hffff00
if a+2200>1999 and a+2200<2399 then couleur = &hff0000
line (a+2200,b+2200) - (c+2200,d+2200), couleur
next k